package com.nbsaas.boot.shopArticle.rest.convert;

import com.nbsaas.boot.shopArticle.data.entity.ShopArticle;
import com.nbsaas.boot.shopArticle.api.domain.simple.ShopArticleSimple;

import com.nbsaas.boot.rest.api.Converter;

/**
* 列表对象转换器
*/

public class ShopArticleSimpleConvert implements Converter<ShopArticleSimple, ShopArticle> {




@Override
public ShopArticleSimple convert(ShopArticle source) {
    ShopArticleSimple result = new ShopArticleSimple();

                result.setImages(source.getImages());
                result.setImg(source.getImg());
                if(source.getShop()!=null){
                    result.setShop(source.getShop().getId());
                }
                result.setComments(source.getComments());
                if(source.getCatalog()!=null){
                    result.setCatalog(source.getCatalog().getId());
                }
                if(source.getDocument()!=null){
                    result.setDocument(source.getDocument().getId());
                }
                if(source.getShop()!=null){
                    result.setShopName(source.getShop().getName());
                }
                result.setTitle(source.getTitle());
                result.setAddDate(source.getAddDate());
                if(source.getCatalog()!=null){
                    result.setCatalogName(source.getCatalog().getName());
                }
                result.setExtData(source.getExtData());
                result.setLogo(source.getLogo());
                result.setUps(source.getUps());
                if(source.getStoreState()!=null){
                    result.setStoreStateName(String.valueOf(source.getStoreState()));
                }
                result.setStoreState(source.getStoreState());
                result.setId(source.getId());
                result.setViews(source.getViews());
                result.setLikes(source.getLikes());
                result.setLastDate(source.getLastDate());


    return result;
}

}